From a0a7752040a304a767c10013c7ca1622885d18dd Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Fri, 29 Jul 2016 16:52:00 -0700 Subject: [PATCH] Add tests for passing both --bin and --lib --- tests/init.rs | 9 +++++++++ tests/new.rs | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/tests/init.rs b/tests/init.rs index f63b249d9..315394359 100644 --- a/tests/init.rs +++ b/tests/init.rs @@ -54,6 +54,15 @@ fn simple_bin() { existing_file()); } +#[test] +fn both_lib_and_bin() { + let td = TempDir::new("cargo").unwrap(); + assert_that(cargo_process("init").arg("--lib").arg("--bin").cwd(td.path().clone()) + .env("USER", "foo"), + execs().with_status(101).with_stderr( + "[ERROR] can't specify both lib and binary outputs")); +} + fn bin_already_exists(explicit: bool, rellocation: &str) { let path = paths::root().join("foo"); fs::create_dir_all(&path.join("src")).unwrap(); diff --git a/tests/new.rs b/tests/new.rs index e58a47188..b0d4163f1 100644 --- a/tests/new.rs +++ b/tests/new.rs @@ -55,6 +55,15 @@ fn simple_bin() { existing_file()); } +#[test] +fn both_lib_and_bin() { + let td = TempDir::new("cargo").unwrap(); + assert_that(cargo_process("new").arg("--lib").arg("--bin").arg("foo").cwd(td.path().clone()) + .env("USER", "foo"), + execs().with_status(101).with_stderr( + "[ERROR] can't specify both lib and binary outputs")); +} + #[test] fn simple_git() { let td = TempDir::new("cargo").unwrap(); -- 2.30.2